import { Rule } from "./types";

export const MetricsRules: Rule[] = [
    {
        id: "Metrics/AbcSize",
        enabled: true,
        descEn: "A calculated magnitude based on number of assignments,branches, and conditions.",
        descCn: "",
        versionAdded: "0.27",
        versionChanged: "1.5",
        paramList: [
            {
                param: "AllowedMethods",
                defaultValue: [],
            },
            {
                param: "AllowedPatterns",
                defaultValue: [],
            },
            {
                param: "CountRepeatedAttributes",
                defaultValue: true,
            },
            {
                param: "Max",
                defaultValue: 17,
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_metrics.html#metricsabcsize",
    },
    {
        id: "Metrics/BlockLength",
        enabled: true,
        descEn: "Avoid long blocks with many lines.",
        descCn: "",
        versionAdded: "0.44",
        versionChanged: "1.5",
        paramList: [
            {
                param: "CountComments",
                defaultValue: false,
            },
            {
                param: "Max",
                defaultValue: 25,
            },
            {
                param: "CountAsOne",
                defaultValue: [],
                optionList: ['array', 'hash', 'heredoc', 'method_call'],
            },
            {
                param: "AllowedMethods",
                defaultValue: ["refine"],
            },
            {
                param: "AllowedPatterns",
                defaultValue: [],
            },
            {
                param: "Exclude",
                defaultValue: ["**/*.gemspec"],
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_metrics.html#metricsblocklength",
    },
    {
        id: "Metrics/BlockNesting",
        enabled: true,
        descEn: "Avoid excessive block nesting.",
        descCn: "",
        versionAdded: "0.25",
        versionChanged: "0.47",
        paramList: [
            {
                param: "CountBlocks",
                defaultValue: false,
            },
            {
                param: "Max",
                defaultValue: 3,
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_metrics.html#metricsblocknesting",
    },
    {
        id: "Metrics/ClassLength",
        enabled: true,
        descEn: "Avoid classes longer than 100 lines of code.",
        descCn: "",
        versionAdded: "0.25",
        versionChanged: "0.87",
        paramList: [
            {
                param: "CountComments",
                defaultValue: false,
            },
            {
                param: "Max",
                defaultValue: 100,
            },
            {
                param: "CountAsOne",
                defaultValue: [],
                optionList: ['array', 'hash', 'heredoc', 'method_call'],
            },
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_metrics.html#metricsclasslength",
    },
    {
        id: "Metrics/CollectionLiteralLength",
        enabled: "pending",
        descEn: "Checks for `Array` or `Hash` literals with many entries.",
        descCn: "",
        versionAdded: "1.47",
        paramList: [
            {
                param: "LengthThreshold",
                defaultValue: 250,
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_metrics.html#metricscollectionliterallength",
    },
    {
        id: "Metrics/CyclomaticComplexity",
        enabled: true,
        descEn: "A complexity metric that is strongly correlated to the number of test cases needed to validate a method.",
        descCn: "",
        versionAdded: "0.25",
        versionChanged: "0.81",
        paramList: [
            {
                param: "AllowedMethods",
                defaultValue: [],
            },
            {
                param: "AllowedPatterns",
                defaultValue: [],
            },
            {
                param: "Max",
                defaultValue: 7,
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_metrics.html#metricscyclomaticcomplexity",
    },
    {
        id: "Metrics/MethodLength",
        enabled: true,
        descEn: "Avoid methods longer than 10 lines of code.",
        descCn: "",
        versionAdded: "0.25",
        versionChanged: "1.5",
        paramList: [
            {
                param: "CountComments",
                defaultValue: false,
            },
            {
                param: "Max",
                defaultValue: 10,
            },
            {
                param: "CountAsOne",
                defaultValue: [],
                optionList: ['array', 'hash', 'heredoc', 'method_call'],
            },
            {
                param: "AllowedMethods",
                defaultValue: [],
            },
            {
                param: "AllowedPatterns",
                defaultValue: [],
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_metrics.html#metricsmethodlength",
    },
    {
        id: "Metrics/ModuleLength",
        enabled: true,
        descEn: "Avoid modules longer than 100 lines of code.",
        descCn: "",
        versionAdded: "0.31",
        versionChanged: "0.87",
        paramList: [
            {
                param: "CountComments",
                defaultValue: false,
            },
            {
                param: "Max",
                defaultValue: 100,
            },
            {
                param: "CountAsOne",
                defaultValue: [],
                optionList: ['array', 'hash', 'heredoc', 'method_call'],
            },
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_metrics.html#metricsmodulelength",
    },
    {
        id: "Metrics/ParameterLists",
        enabled: true,
        descEn: "Avoid parameter lists longer than three or four parameters.",
        descCn: "",
        versionAdded: "0.25",
        versionChanged: "1.5",
        paramList: [
            {
                param: "Max",
                defaultValue: 5,
            },
            {
                param: "CountKeywordArgs",
                defaultValue: true,
            },
            {
                param: "MaxOptionalParameters",
                defaultValue: 3,
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_metrics.html#metricsparameterlists",
    },
    {
        id: "Metrics/PerceivedComplexity",
        enabled: true,
        descEn: "A complexity metric geared towards measuring complexity for a human reader.",
        descCn: "",
        versionAdded: "0.25",
        versionChanged: "0.81",
        paramList: [
            {
                param: "AllowedMethods",
                defaultValue: [],
            },
            {
                param: "AllowedPatterns",
                defaultValue: [],
            },
            {
                param: "Max",
                defaultValue: 8,
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_metrics.html#metricsperceivedcomplexity",
    },
];